package org.lc.service.system.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.lc.platform.base.result.Result;
import org.lc.platform.base.annotation.IsUUID;
import org.lc.platform.mybatis.crud.controller.CrudBaseController;
import org.lc.service.system.dto.SysMenuDto;
import org.lc.service.system.entity.SysMenu;
import org.lc.service.system.service.SysMenuService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@Validated
@RestController
@RequestMapping("/menu")
@Tag(name = "菜单模块")
public class SysMenuController extends CrudBaseController<SysMenu, SysMenu, SysMenuDto, SysMenuService> {
    public SysMenuController(SysMenuService service) {
        super(service);
    }


    @Operation(summary = "获取菜单树")
    @GetMapping("/tree/list")
    private Result<List<SysMenu>> getMenuTreeList() {
        return Result.data(this.getService().getMenuTreeList());
    }

    @Operation(summary = "获取菜单权限树")
    @GetMapping("/tree/acl/{role}")
    private Result<Map<String, Object>> getMenuTreeAcl(@IsUUID @PathVariable("role") String role) {
        return Result.data(this.getService().getMenuTreeAcl(role));
    }
}